home *** CD-ROM | disk | FTP | other *** search
- Path: siemens.at!david
- From: david@ws2309.gud.siemens.co.at (Hr.McCann)
- Newsgroups: comp.lang.c++,comp.sys.hp.hpux
- Subject: Re: Problem combining signal() with exceptions on HP-UX (ugh!)
- Followup-To: comp.lang.c++,comp.sys.hp.hpux
- Date: 2 Apr 1996 07:08:06 GMT
- Organization: Siemens AG Austria
- Message-ID: <4jqjom$99u@news.siemens.at>
- References: <4iohb5$e9i@gossamer.itmel.bhp.com.au>
- Reply-To: David.McCann@siemens.co.at
- NNTP-Posting-Host: ws2309.gud.siemens-austria
- X-Newsreader: TIN [version 1.1 PL8]
-
- Chris Kuan (kuan.chris.ch@bhp.com.au) wrote:
-
- > I'm running HP CC on HP-UX 9, and trying to catch signals and turn them
- > into exceptions.
-
- > Question : how can I get signalling and exception handling to work consistently?
- > - and don't say, "Don't do it." It's beyond my control as to WHY this is
- > necessary :-(
-
- Don't do it :-). Really. Exceptions are not designed to cope with asynchronous
- events like external signals. If you read almost any literature on the subject,
- you should know this. Your design is wrong.
-
- That said, if you really really really must turn signals into exceptions, then
- the only clean way I can think of is to set some global flag in a signal handler
- to say 'signal occurred' and then return. However, your program code then has to
- poll this flag at appropriate intervals (ouch!).
-
- Furthermore, this approach wouldn't work for signals like SIGSEGV, because you'd
- be resuming execution from the statement that caused the signal to be raised,
- with undefined results (probably another SIGSEGV, causing an endless loop! I've
- seen this happen many times before now!).
-
- If you're still hell-bent on this approach, then good luck. You'll need it :-(
-
- David.
-
- =====================================================================
- David McCann | MAIL: David.McCann@siemens.co.at
- PSE TMN 23 |
- Siemens AG Austria | VOICE: +43 1 1707-45606
- Gudrunstrasse 11 | FAX: +43 1 1707-55712
- A-1101 Wien | Broker FAQ: http://mx2310/Broker/
- =====================================================================
-